<template>
  <div
    class="relative cursor-pointer header"
    :class="[activeClass]"
    @click="goto(activeClass)"
  >
      <slot name="nav"></slot>
      <div class="absolute py-5 slide">
        <div class="wrapper">
          <div class="flex items-center justify-center">
            <div
              class="mx-3 duration-300 cursor-pointer hover:scale-105"
              :class="{ active: activeClass === 'qmxb' }"
              @click.stop="activeClass = 'qmxb'"
            >
              <img src="../assets/home_slide_1.png" alt="全民学霸" />
            </div>
            <div
              class="mx-3 duration-300 cursor-pointer hover:scale-105"
              :class="{ active: activeClass === 'mrz' }"
              @click.stop="activeClass = 'mrz'"
            >
              <img src="../assets/home_slide_2.png" alt="美人传" />
            </div>
          </div>
        </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
const activeClass = ref('qmxb')

function goto(url) {
  window.location.href = `/${url}/`
}
</script>

<style lang="scss" scoped>
.header {
  height: 951px;
  min-width: 1205px;
  background-repeat: no-repeat;
  background-position: top center;
  &.mrz {
    background-image: url(../assets/mrz.webp);
  }
  &.qmxb {
    background-image: url(../assets/qmxb.webp);
  }
}
.slide {
  left:0;
  right:0;
  bottom:0;
  height:190px;
  background-color: rgba(25, 25, 25, 0.7);
  img {
    width: 300px;
    height: 150px;
    border: 3px solid transparent;
    border-radius: 34px;
    transition: all 0.2s ease-in;
    opacity: 0.9;
    box-sizing: border-box;
  }
  .active {
    img {
      opacity: 1;
      border: 3px solid rgba(255, 255, 255, 0.8);
      box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.4);
    }
  }
}
</style>
